import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Layout from '@/views/Layout.vue';
declare const window: Window & {
  __POWERED_BY_QIANKUN__: boolean;
  __INJECTED_PUBLIC_PATH_BY_QIANKUN__: string;
};

declare let __webpack_public_path__: string;
//如果乾坤加载就匹配vue,不加载：/
const BASE_NAME = window.__POWERED_BY_QIANKUN__ ? "/organization" : "/";
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_NAME),
  routes: [
    {
      path: '/home',
      name: 'home',
      component: HomeView,
    },
    {
      path: '/',
      name: 'layout',
      component: Layout,
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/AboutView.vue'),
    },
  ],
})

export default router
